<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of addForm
 *
 * @author Admin
 */
class Application_Form_switch_AddForm extends Zend_Form {

    public function __construct($options = null) {
        parent::__construct($options);

        $switchName = new Zend_Form_Element_Text('switchName');
        $switchName->addFilter('StripTags')
                ->addFilter('StringTrim')
                //->setRequired(true)
                ->setDecorators(array('ViewHelper', 'Errors'));

        $tomtprojektering = new Zend_Form_Element_Text('tomtprojektering');
        $tomtprojektering->addFilter('StripTags')
                ->addFilter('StringTrim')
             //   ->setRequired(true)
                ->setDecorators(array('ViewHelper', 'Errors'));

        $anmarkning_tomt = new Zend_Form_Element_Textarea('anmarkning_tomt');
        $anmarkning_tomt->addFilter('StripTags')
                ->setAttrib('rows', 3)
                ->setAttrib('cols', 18)
                ->addFilter('StringTrim')
           //     ->setRequired(true)
                ->setDecorators(array('ViewHelper', 'Errors'));

        $gravd_datum = new Zend_Form_Element_Text('gravd_datum');
        $gravd_datum->addFilter('StripTags')
                ->addFilter('StringTrim')
            //    ->setRequired(true)
                ->setDecorators(array('ViewHelper', 'Errors'));

        $gravd_av = new Zend_Form_Element_Text('gravd_av');
        $gravd_av->addFilter('StripTags')
                ->addFilter('StringTrim')
          //      ->setRequired(true)
                ->setDecorators(array('ViewHelper', 'Errors'));

        
        $gravd_meter = new Zend_Form_Element_Text('gravd_meter');
        $gravd_meter->addFilter('StripTags')
                ->addFilter('StringTrim')
           //     ->setRequired(true)
                ->setDecorators(array('ViewHelper', 'Errors'));

        $gravd_timmar = new Zend_Form_Element_Text('gravd_timmar');
        $gravd_timmar->addFilter('StripTags')
                ->addFilter('StringTrim')
          //      ->setRequired(true)
                ->setDecorators(array('ViewHelper', 'Errors'));

        $kopplad = new Zend_Form_Element_Text('kopplad');
        $kopplad->addFilter('StripTags')
                ->addFilter('StringTrim')
          //      ->setRequired(true)
                ->setDecorators(array('ViewHelper', 'Errors'));

        $vagschakt_projekterad = new Zend_Form_Element_Text('vagschakt_projekterad');
        $vagschakt_projekterad->addFilter('StripTags')
                ->addFilter('StringTrim')
         //       ->setRequired(true)
                ->setDecorators(array('ViewHelper', 'Errors'));

        $vagschakt_avropad = new Zend_Form_Element_Text('vagschakt_avropad');
        $vagschakt_avropad->addFilter('StripTags')
                ->addFilter('StringTrim')
          //      ->setRequired(true)
                ->setDecorators(array('ViewHelper', 'Errors'));

        $vagschakt_klar = new Zend_Form_Element_Text('vagschakt_klar');
        $vagschakt_klar->addFilter('StripTags')
                ->addFilter('StringTrim')
          //      ->setRequired(true)
                ->setDecorators(array('ViewHelper', 'Errors'));

        $odf = new Zend_Form_Element_Text('odf');
        $odf->addFilter('StripTags')
                ->addFilter('StringTrim')
          //      ->setRequired(true)
                ->setDecorators(array('ViewHelper', 'Errors'));

        $port = new Zend_Form_Element_Text('port');
        $port->addFilter('StripTags')
                ->addFilter('StringTrim')
          //      ->setRequired(true)
                ->setDecorators(array('ViewHelper', 'Errors'));

        $datum_patch = new Zend_Form_Element_Text('datum_patch');
        $datum_patch->addFilter('StripTags')
                ->addFilter('StringTrim')
          //      ->setRequired(true)
                ->setDecorators(array('ViewHelper', 'Errors'));


        $cabinetModel = new Application_Model_CabinetModel();
        $cabinetDetails = $cabinetModel->fetchAll("status = 'Active'");
        
        $cabinetList = new Zend_Form_Element_Select('cabinetList');
        $cabinetList->setSeparator("");        
                foreach($cabinetDetails as $items){
        $cabinetList->addMultiOption($items->id, $items->name);
                }
         $cabinetList ->setDecorators(array('ViewHelper', 'Errors'));


        $status = new Zend_Form_Element_Select('status');
        $status->addMultiOption('active', ' Active')
                ->addMultiOption('inactive', ' Inactive')
                ->setSeparator("")
                ->setValue('active')
                ->setDecorators(array('ViewHelper', 'Errors'));


        $this->addElements(array($switchName, $cabinetList, $status,$tomtprojektering,$anmarkning_tomt,$gravd_datum,$gravd_av,$gravd_meter,$gravd_timmar,$kopplad,$vagschakt_projekterad,$vagschakt_avropad,$vagschakt_klar,$odf,$port,$datum_patch));
    }

}